<!--
 * @Author: 李瑞清
 * @Date: 2023-02-24 17:28:14
 * @LastEditors: 李瑞清 alger_li@163.com
 * @LastEditTime: 2023-03-09 10:36:43
 * @FilePath: \oms\page\scale\index.html
 * @Description:
-->

<body style="width: 100%">
<div id="_iframe_" style="width: 100%; height: 100%;"></div>
</body>
<script>
    require(["jquery", "bbcare"], function ($, $bb) {
        const data = $('.content-main').data()

        var sessionId = sessionStorage.getItem('sessionId')

        var account = JSON.parse(sessionStorage.getItem('account'))

        var currentProjectName = document.getElementsByClassName('tenant_name')[0].innerText
        var doctorName = account.alias
        let deptName = sessionStorage.getItem('hosipitalName')
        var hosipitalName = ''
        try {
            hosipitalName = sessionStorage.getItem('hosipitalName')
        } catch (err) { }
        var tenantId = ''
        account.apps.forEach(function (item) {

            if (item.tenantName === currentProjectName) {
                tenantId = item.tenantId
                hosipitalName = item.appAlias
            }
        })
        var URL = $bb.baseUrl("scale")

        var scaleId = window._config

        var iframe = document.createElement('iframe')
        var src
        if (data.params.name) {
            $('li[data-name=userScaleList]').text(data.params.row.scaleName)
            src = URL + '#/kangfu?sessionId=' + sessionId + '&scaleId=' + data.params.row.scaleUuid + '&tenantId=' + tenantId + '&projectName=' + hosipitalName + '&doctorName=' + doctorName
            src += '&recordId=' + data.params.row.recordId + '&name=' + data.params.name + '&patientId=' + data.params.row.userId+ '&deptName=' + deptName
        } else {
            src = URL + '#/kangfu?sessionId=' + sessionId + '&scaleId=11111' + '&tenantId=' + tenantId + '&projectName=' + hosipitalName + '&doctorName=' + doctorName + '&deptName=' + deptName
        }
        iframe.setAttribute('src', src)
        iframe.setAttribute('style', 'border: none;width: 100%;height: 95%;')
        document.getElementById('_iframe_').appendChild(iframe)
    })
</script>
